﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Database.Models
{
    [Table("HangMuc")]
    public class HangMuc : BaseModel
    {
        public int Id { get; set; }

        [Required]
        [MaxLength(255)]
        public string TenCongTrinh { get; set; }

        public int? DienTichM2 { get; set; }

        public int? SoTang { get; set; }

        public int? DienTichM3 { get; set; }

        public int? SoPhong { get; set; }

        public virtual HangSanXuat HangSanXuat { get; set; }
        public virtual BacChiuLua BacChiuLua { get; set; }
        public virtual PhieuDieuTraCoSo PhieuDieuTraCoSo { get; set; }

        [MaxLength(255)]
        public string TenChatChay { get; set; }

        public int? DienTichChatChayM2 { get; set; }

        [NotMapped]
        public virtual string TenHangSanXuat
        {
            get
            {
                if (HangSanXuat != null)
                {
                    return HangSanXuat.Ten;
                }
                return string.Empty;
            }
        }

        [NotMapped]
        public virtual string TenBacChiuLua
        {
            get
            {
                if (BacChiuLua != null)
                {
                    return BacChiuLua.Ten;
                }
                return string.Empty;
            }
        }
    }
}
